package com.turnengine.client.global.game.command;

import com.javabi.command.IExecutableCommand;
import com.javabi.command.IExecutableCommandResponse;
import com.javabi.command.serializer.AbstractCommandDataSerializer;
import com.javabi.common.io.data.IDataReader;
import com.javabi.common.io.data.IDataWriter;
import com.turnengine.client.global.game.bean.GameHostSerializer;
import com.turnengine.client.global.game.bean.IGameHost;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * The Get Game Hosts Data Serializer.
 */
public class GetGameHostsDataSerializer extends AbstractCommandDataSerializer<List<IGameHost>> implements IGetGameHostsDataSerializer {

	/**
	 * Creates a new Get Game Hosts Data Serializer.
	 */
	public GetGameHostsDataSerializer() {
		super(GetGameHosts.COMMAND_ID);
	}

	@Override
	public List<IGameHost> readReturnValue(IDataReader reader) throws IOException {
		List<IGameHost> value = reader.readObjectCollection(new ArrayList<IGameHost>(), true, false, new GameHostSerializer());
		return value;
	}

	@Override
	public void writeReturnValue(IDataWriter writer, List<IGameHost> value) throws IOException {
		writer.writeObjectCollection(value, true, false, new GameHostSerializer());
	}

	@Override
	public IExecutableCommand<List<IGameHost>> readRequest(IDataReader reader) throws IOException {

		// Read fields

		// Create object
		GetGameHosts object = new GetGameHosts();
		return object;
	}

	@Override
	public void writeRequest(IDataWriter writer, IExecutableCommand<List<IGameHost>> argument) throws IOException {
		GetGameHosts object = (GetGameHosts) argument;

		// Get fields

		// Write fields
	}

	@Override
	public IExecutableCommandResponse<List<IGameHost>> newResponse() {
		return new GetGameHostsResponse();
	}
}
